<?php
//10 =》 27进制
function en_id($num=0)
{
    $arr=array('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','h','i','j','k','m','n','p','r','t','u','v','w','x','y','z');
    $t='';
    while($num>0)
    {
        $t=$arr[$num%count($arr)].$t;
        $num=floor($num/count($arr));
    }
    return $t==''?0:$t;
}
//27 =》 10进制
function de_id($d='a'){
    $num=0;
    $i=1;
    $arr=array('1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','h','i','j','k','m','n','p','r','t','u','v','w','x','y','z');
    $d=str_split($d);
    foreach($d as $key=>$n)
    {
        $num+=pow(count($arr),count($d)-$i)*array_search($n, $arr);
        $i++;
    }
    return $num;
}
